<html>
<head><meta charset="utf-8"><title>Replace fragile erroneous const sys #70820 · t-compiler/wg-mir-opt · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/index.html">t-compiler/wg-mir-opt</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html">Replace fragile erroneous const sys #70820</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="194491022"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194491022" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194491022">(Apr 17 2020 at 19:46)</a>:</h4>
<p>This PR should be ready for review, cc <span class="user-mention" data-user-id="124288">@oli</span> <span class="user-mention" data-user-id="119009">@eddyb</span></p>



<a name="194491050"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194491050" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194491050">(Apr 17 2020 at 19:47)</a>:</h4>
<p>one thing I see though is that after running with --bless I see this changes ...</p>



<a name="194491066"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194491066" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194491066">(Apr 17 2020 at 19:47)</a>:</h4>
<div class="codehilite"><pre><span></span>diff --git a/src/test/mir-opt/const_allocation2/64bit/rustc.main.ConstProp.after.mir b/src/test/mir-opt/const_allocation2/64bit/rustc.main.ConstProp.after.mir
index e61f0a8b69f..6d2806d820d 100644
--- a/src/test/mir-opt/const_allocation2/64bit/rustc.main.ConstProp.after.mir
+++ b/src/test/mir-opt/const_allocation2/64bit/rustc.main.ConstProp.after.mir
@@ -30,44 +30,44 @@ fn main() -&gt; () {
 }

 alloc0 (static: FOO, size: 16, align: 8) {
-    ╾──────alloc24+0──────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
+    ╾──────alloc20+0──────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
 }

-alloc24 (size: 72, align: 8) {
-    0x00 │ 00 00 00 00 __ __ __ __ ╾──────alloc9+0───────╼ │ ....░░░░╾──────╼
+alloc20 (size: 72, align: 8) {
+    0x00 │ 00 00 00 00 __ __ __ __ ╾──────alloc4+0───────╼ │ ....░░░░╾──────╼
     0x10 │ 00 00 00 00 00 00 00 00 00 00 00 00 __ __ __ __ │ ............░░░░
-    0x20 │ ╾──────alloc14+0──────╼ 02 00 00 00 00 00 00 00 │ ╾──────╼........
-    0x30 │ 01 00 00 00 2a 00 00 00 ╾──────alloc22+0──────╼ │ ....*...╾──────╼
+    0x20 │ ╾──────alloc9+0───────╼ 02 00 00 00 00 00 00 00 │ ╾──────╼........
+    0x30 │ 01 00 00 00 2a 00 00 00 ╾──────alloc18+0──────╼ │ ....*...╾──────╼
     0x40 │ 03 00 00 00 00 00 00 00                         │ ........
 }

-alloc9 (size: 0, align: 8) {}
+alloc4 (size: 0, align: 8) {}

-alloc14 (size: 16, align: 8) {
-    ╾──────alloc12+0──────╼ ╾──────alloc13+0──────╼ │ ╾──────╼╾──────╼
+alloc9 (size: 16, align: 8) {
+    ╾──────alloc7+0───────╼ ╾──────alloc8+0───────╼ │ ╾──────╼╾──────╼
 }

-alloc12 (size: 1, align: 1) {
+alloc7 (size: 1, align: 1) {
     05                                              │ .
 }

-alloc13 (size: 1, align: 1) {
+alloc8 (size: 1, align: 1) {
     06                                              │ .
 }

-alloc22 (size: 24, align: 8) {
-    0x00 │ ╾──────alloc18+3──────╼ ╾──────alloc19+0──────╼ │ ╾──────╼╾──────╼
-    0x10 │ ╾──────alloc21+2──────╼                         │ ╾──────╼
+alloc18 (size: 24, align: 8) {
+    0x00 │ ╾──────alloc14+3──────╼ ╾──────alloc15+0──────╼ │ ╾──────╼╾──────╼
+    0x10 │ ╾──────alloc17+2──────╼                         │ ╾──────╼
 }

-alloc18 (size: 4, align: 1) {
+alloc14 (size: 4, align: 1) {
     2a 45 15 6f                                     │ *E.o
 }

-alloc19 (size: 1, align: 1) {
+alloc15 (size: 1, align: 1) {
     2a                                              │ *
 }

-alloc21 (size: 4, align: 1) {
+alloc17 (size: 4, align: 1) {
     2a 45 15 6f                                     │ *E.o
 }
diff --git a/src/test/mir-opt/retain-never-const/rustc.no_codegen.PreCodegen.after.mir b/src/test/mir-opt/retain-never-const/rustc.no_codegen.PreCodegen.after.mir
index 2d7a79ee44c..07d28efb9c3 100644
--- a/src/test/mir-opt/retain-never-const/rustc.no_codegen.PreCodegen.after.mir
+++ b/src/test/mir-opt/retain-never-const/rustc.no_codegen.PreCodegen.after.mir
@@ -2,20 +2,10 @@

 fn no_codegen() -&gt; () {
     let mut _0: ();                      // return place in scope 0 at $DIR/retain-never-const.rs:18:20: 18:20
-    let mut _1: !;                       // in scope 0 at $DIR/retain-never-const.rs:19:13: 19:33
     scope 1 {
     }

     bb0: {
-        StorageLive(_1);                 // bb0[0]: scope 0 at $DIR/retain-never-const.rs:19:13: 19:33
-        _1 = const PrintName::&lt;T&gt;::VOID; // bb0[1]: scope 0 at $DIR/retain-never-const.rs:19:13: 19:33
-                                         // ty::Const
-                                         // + ty: !
-                                         // + val: Unevaluated(DefId(0:9 ~ retain_never_const[317d]::{{impl}}[0]::VOID[0]), [T], None)
-                                         // mir::Constant
-                                         // + span: $DIR/retain-never-const.rs:19:13: 19:33
-                                         // + user_ty: UserType(0)
-                                         // + literal: Const { ty: !, val: Unevaluated(DefId(0:9 ~ retain_never_const[317d]::{{impl}}[0]::VOID[0]), [T], None) }
-        unreachable;                     // bb0[2]: scope 0 at $DIR/retain-never-const.rs:19:13: 19:33
+        unreachable;                     // bb0[0]: scope 0 at $DIR/retain-never-const.rs:19:13: 19:33
     }
 }
</pre></div>



<a name="194491083"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194491083" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194491083">(Apr 17 2020 at 19:47)</a>:</h4>
<p>cc <span class="user-mention" data-user-id="125250">@Wesley Wiser</span> also</p>



<a name="194491183"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194491183" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194491183">(Apr 17 2020 at 19:48)</a>:</h4>
<p>checking if those changes are expected ...</p>



<a name="194491217"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194491217" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194491217">(Apr 17 2020 at 19:48)</a>:</h4>
<p>It looks like a bunch of allocations got removed which is what we wanted to see.</p>



<a name="194491259"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194491259" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194491259">(Apr 17 2020 at 19:49)</a>:</h4>
<p>So good work <span aria-label="thumbs up" class="emoji emoji-1f44d" role="img" title="thumbs up">:thumbs_up:</span> <span aria-label="slight smile" class="emoji emoji-1f642" role="img" title="slight smile">:slight_smile:</span></p>



<a name="194491311"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194491311" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194491311">(Apr 17 2020 at 19:49)</a>:</h4>
<p>Have you done a perf run by any chance?</p>



<a name="194491358"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194491358" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194491358">(Apr 17 2020 at 19:50)</a>:</h4>
<p>nope</p>



<a name="194491422"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194491422" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194491422">(Apr 17 2020 at 19:50)</a>:</h4>
<p>I don't think there would be any regressions but we should <code>rollup=never</code> that PR</p>



<a name="194491608"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194491608" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194491608">(Apr 17 2020 at 19:52)</a>:</h4>
<p><span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span></p>



<a name="194491624"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194491624" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194491624">(Apr 17 2020 at 19:52)</a>:</h4>
<p>can I rollup=never before accepting it?</p>



<a name="194491649"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194491649" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194491649">(Apr 17 2020 at 19:52)</a>:</h4>
<p>maybe we should just comment that for the one that approves this</p>



<a name="194491764"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194491764" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194491764">(Apr 17 2020 at 19:53)</a>:</h4>
<p>Yeah, I think you can do that at any time</p>



<a name="194491878"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194491878" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194491878">(Apr 17 2020 at 19:54)</a>:</h4>
<p>You can check the queue to see if it took effect <a href="https://buildbot2.rust-lang.org/homu/queue/rust" title="https://buildbot2.rust-lang.org/homu/queue/rust">https://buildbot2.rust-lang.org/homu/queue/rust</a></p>



<a name="194492726"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194492726" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194492726">(Apr 17 2020 at 20:00)</a>:</h4>
<p>one pending thing I have is ...</p>



<a name="194492727"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194492727" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194492727">(Apr 17 2020 at 20:00)</a>:</h4>
<ul>
<li>Change the <code>Vec&lt;Const&gt;</code> to be <code>IndexVec&lt;ConstId, &amp;'tcx ty::Const&lt;'tcx&gt;&gt;</code> and have the MIR store <code>ConstId</code> instead of repeating the whole <code>Const</code>.</li>
</ul>



<a name="194492873"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194492873" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194492873">(Apr 17 2020 at 20:02)</a>:</h4>
<p>anyway I think this could be merged as is and that could be done on a separate PR</p>



<a name="194492882"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194492882" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194492882">(Apr 17 2020 at 20:02)</a>:</h4>
<p>cc <span class="user-mention" data-user-id="124288">@oli</span></p>



<a name="194585895"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194585895" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194585895">(Apr 19 2020 at 08:25)</a>:</h4>
<p>also I have a terminology question at <a href="https://github.com/rust-lang/rust/pull/70820#discussion_r410522129" title="https://github.com/rust-lang/rust/pull/70820#discussion_r410522129">https://github.com/rust-lang/rust/pull/70820#discussion_r410522129</a></p>



<a name="194598086"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194598086" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194598086">(Apr 19 2020 at 13:37)</a>:</h4>
<p><span class="user-mention" data-user-id="120791">@RalfJ</span> will check this out tomorrow</p>



<a name="194802109"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194802109" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194802109">(Apr 21 2020 at 13:35)</a>:</h4>
<p>btw, this PR <a href="https://github.com/rust-lang/rust/issues/70820" title="https://github.com/rust-lang/rust/issues/70820">#70820</a> is ready for review cc <span class="user-mention" data-user-id="124288">@oli</span> <span class="user-mention" data-user-id="119009">@eddyb</span></p>



<a name="194803800"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194803800" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194803800">(Apr 21 2020 at 13:49)</a>:</h4>
<p>just the the move from visit_body to super_body, then it lgtm</p>



<a name="194803945"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194803945" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194803945">(Apr 21 2020 at 13:50)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@oli</span> right, it makes sense</p>



<a name="194803964"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194803964" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194803964">(Apr 21 2020 at 13:50)</a>:</h4>
<p>will do it quickly</p>



<a name="194804908"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194804908" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194804908">(Apr 21 2020 at 13:57)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@oli</span> pushed, let's see if CI is happy</p>



<a name="194805632"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194805632" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194805632">(Apr 21 2020 at 14:01)</a>:</h4>
<p>got an ICE</p>



<a name="194805807"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194805807" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194805807">(Apr 21 2020 at 14:02)</a>:</h4>
<div class="codehilite"><pre><span></span>query stack during panic:
#0 [optimized_mir] processing `num::&lt;impl i128&gt;::min_value`  |  = note: this failure-note originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

#1 [const_eval_raw] const-evaluating `num::&lt;impl i128&gt;::min_value`  |  = note: this failure-note originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

#2 [const_eval_raw] const-evaluating `i128::MIN`
#3 [const_eval_validated] const-evaluating + checking `i128::MIN`
#4 [const_eval_validated] const-evaluating + checking `i128::MIN`
#5 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `core`.
</pre></div>



<a name="194805837"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194805837" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194805837">(Apr 21 2020 at 14:03)</a>:</h4>
<div class="codehilite"><pre><span></span>thread &#39;rustc&#39; panicked at &#39;called `Option::unwrap()` on a `None` value&#39;, src/librustc_mir/transform/const_prop.rs:823:38
</pre></div>



<a name="194806042"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194806042" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194806042">(Apr 21 2020 at 14:04)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@oli</span> <a href="https://github.com/rust-lang/rust/blob/9601d1fc7b448e28675d758e606f8be8f2a9ff7f/src/librustc_mir/transform/const_prop.rs#L823" title="https://github.com/rust-lang/rust/blob/9601d1fc7b448e28675d758e606f8be8f2a9ff7f/src/librustc_mir/transform/const_prop.rs#L823">https://github.com/rust-lang/rust/blob/9601d1fc7b448e28675d758e606f8be8f2a9ff7f/src/librustc_mir/transform/const_prop.rs#L823</a>, <code>source_info</code> is <code>None</code> in this case</p>



<a name="194806245"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194806245" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194806245">(Apr 21 2020 at 14:05)</a>:</h4>
<p>actually, why do we want this in the <code>Visitor</code>? won't this make the code to be evaluated several times? like one for each visitor that doesn't override <code>visit_body</code> or overrides it but calls <code>super_body</code>?</p>



<a name="194806560"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194806560" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194806560">(Apr 21 2020 at 14:07)</a>:</h4>
<p>I think I've fixed the problem, testing but still ... won't be call this several times?</p>



<a name="194807095"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194807095" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194807095">(Apr 21 2020 at 14:10)</a>:</h4>
<p>sec, let me check the PR diff</p>



<a name="194807174"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194807174" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194807174">(Apr 21 2020 at 14:11)</a>:</h4>
<p>all this does is cause <code>visit_constant</code> to be called, there's no evaluation happening there unless the visitor chooses to do so</p>



<a name="194807218"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194807218" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194807218">(Apr 21 2020 at 14:11)</a>:</h4>
<p>ohh you're right</p>



<a name="194807245"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194807245" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194807245">(Apr 21 2020 at 14:11)</a>:</h4>
<p>ok, let's wait for the CI and ship it then :)</p>



<a name="194807303"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194807303" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194807303">(Apr 21 2020 at 14:12)</a>:</h4>
<p><span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span></p>



<a name="194807312"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194807312" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194807312">(Apr 21 2020 at 14:12)</a>:</h4>
<p>r=me with CI passing</p>



<a name="194809838"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194809838" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194809838">(Apr 21 2020 at 14:30)</a>:</h4>
<p>got a bunch of failures <a href="https://gist.github.com/spastorino/2c3fd74d12ab7a39d073328fbd3b58f3" title="https://gist.github.com/spastorino/2c3fd74d12ab7a39d073328fbd3b58f3">https://gist.github.com/spastorino/2c3fd74d12ab7a39d073328fbd3b58f3</a></p>



<a name="194810279"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194810279" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194810279">(Apr 21 2020 at 14:33)</a>:</h4>
<p>hmm... while we could just bless them away, I think for now it would be best to check which <code>visit_constant</code> implementor causes this and make its <code>visit_body</code> function not invoke <code>super_body</code>, but just walk the blocks and nothing else</p>



<a name="194810592"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194810592" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194810592">(Apr 21 2020 at 14:35)</a>:</h4>
<p>makes sense</p>



<a name="194815321"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194815321" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194815321">(Apr 21 2020 at 15:04)</a>:</h4>
<p>so as <code>visit_constant</code> implementors we have <a href="https://github.com/rust-lang/rust/blob/2db3c35b3f5bafd884a4e206916137892798f595/src/librustc_mir/util/pretty.rs#L375" title="https://github.com/rust-lang/rust/blob/2db3c35b3f5bafd884a4e206916137892798f595/src/librustc_mir/util/pretty.rs#L375">ExtraComments</a>, <a href="https://github.com/rust-lang/rust/blob/2db3c35b3f5bafd884a4e206916137892798f595/src/librustc_mir/transform/const_prop.rs#L820" title="https://github.com/rust-lang/rust/blob/2db3c35b3f5bafd884a4e206916137892798f595/src/librustc_mir/transform/const_prop.rs#L820">ConstPropagator</a> and <a href="https://github.com/rust-lang/rust/blob/2db3c35b3f5bafd884a4e206916137892798f595/src/librustc_mir/borrow_check/type_check/mod.rs#L286" title="https://github.com/rust-lang/rust/blob/2db3c35b3f5bafd884a4e206916137892798f595/src/librustc_mir/borrow_check/type_check/mod.rs#L286">TypeVerifier</a></p>



<a name="194815768"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194815768" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194815768">(Apr 21 2020 at 15:07)</a>:</h4>
<p>gonna try to see which one causes this</p>



<a name="194816312"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194816312" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194816312">(Apr 21 2020 at 15:11)</a>:</h4>
<p><code>ConstProp</code> is a likely candidate considering the additional diagnostics</p>



<a name="194819562"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194819562" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194819562">(Apr 21 2020 at 15:30)</a>:</h4>
<p>yeap</p>



<a name="194819873"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Replace%20fragile%20erroneous%20const%20sys%20%2370820/near/194819873" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820.html#194819873">(Apr 21 2020 at 15:32)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820/near/194816312" title="#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/Replace.20fragile.20erroneous.20const.20sys.20.2370820/near/194816312">said</a>:</p>
<blockquote>
<p><code>ConstProp</code> is a likely candidate considering the additional diagnostics</p>
</blockquote>
<p>I'm not sure what exactly do we want visit_body to do there, the most obvious thing that will work is to not have those calls I've added but keep the rest of the behavior</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>